#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<vector>
#include<queue>
#include<cstdlib>//rand()
#define rep(i,a,b) for(register long long i = (a);i <= (b);++i)
#define per(i,a,b) for(register long long i = (a);i >= (b);--i)
typedef long long ll;
typedef unsigned long long ull;
using std::string;using std::cin;using std::cout;

bool flag;
int _,n,h,r;
struct node{
    ll x,y,z;
}m[1111];

inline bool cmp(node a,node b){return a.z < b.z;}

inline ll dis(node a,node b){
    return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y) + (a.z - b.z) * (a.z - b.z);
}

inline void dfs(int pre){
    if(m[pre].z + r >= h){
        flag = true;
        return;
    }
    rep(i,pre+1,n){
        if(dis(m[i],m[pre]) > 4ll * r * r) continue;
        if(flag) break;
        dfs(i);
    }
    return;
}

int main(){
    std::ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    //freopen("in.in", "r", stdin);
    cin >> _;
    while(_--){
        flag = false;
        cin >> n >> h >> r;
        rep(i,1,n) cin >> m[i].x >> m[i].y >> m[i].z;
        std::sort(m+1,m+n+1,cmp);
        rep(i,1,n){
            if(m[i].z + r < 0) continue;
            if(m[i].z - r > 0 || flag) break;
            dfs(i);

        }
        if(flag) cout << "Yes\n";
        else cout << "No\n";
    }
    return 0;
}
